
package graphics2d;

import java.awt.Dimension;
import java.awt.Toolkit;
import javax.swing.JFrame;
//import javax.swing.JPanel;

public class Graphics2d {

    public static void main(String[] args) {
        
        Toolkit dt = Toolkit.getDefaultToolkit();
        Dimension screenSize = dt.getScreenSize();
        int frameHeight = screenSize.height;
        int frameWidth = screenSize.width;
        
        int L = -68;
        int R = 68;
        int B = -38;
        int T = 38;
        
        double[] star_vertexes = new double[]{4, 2, 7, 12, 10,
                                              1, 6, 9,  6,  1,
                                              1, 1, 1,  1,  1};
        boolean[] star_ribs = new boolean[]{false,  true, true, false,
                                                   false, true,  true,
                                                         false,  true,
                                                                false};
        Object star = new Object(new Matrix(5, star_vertexes), new Ribs(5, star_ribs), 2);
        
        double[] centr_vertexes = new double[]{-0.5,   0, 0.5,     0,
                                                  0, 0.5,   0,  -0.5,
                                                  1,   1,   1,     1};
        boolean[] centr_ribs = new boolean[]{false,  true, false, 
                                                    false,  true,
                                                           false};
        Object centr = new Object(new Matrix(4, centr_vertexes), new Ribs(4, centr_ribs));
        
        Scene scene = new Scene(frameWidth, frameHeight, L, R, B, T);
        scene.add(centr);
        scene.add(star);
        
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(frameWidth, frameHeight);
        frame.getContentPane().add(scene);
        frame.setVisible(true);
        frame.addKeyListener(new KeyboardController(scene, star));
        //frame.addKeyListener(new KeyboardController(scene, centr));
        
        star.scale(3, 3.1);

    }
    
}
